<?php


namespace app\controller;

use app\BaseController;
use app\Request;
use app\service\accountService;
use think\response\Json;

class User extends BaseController
{
    // 注册
    public function register(): Json
    {
        $data = request()->post();
        return accountService::resign($data);

    }

    // 登陆
    public function login(): Json
    {
        $data = request()->post();
        return accountService::login($data);

    }

    //用户信息
    public function userInfo(Request $request): Json
    {

        return accountService::userInfo($request->uid);
    }

    //验证码
    public function verify(): Json
    {
        return accountService::getVerify();
    }

    //用户列表
    public function userList(Request $request): Json
    {
        $data = $request->get('username');
        $page = $request->get('current');
        return accountService::getUserList($data, $page);
    }

    //修改用户
    public function editUser(Request $request):Json
    {
        $data = $request->get();
        return accountService::edit($data);
    }

}